package net.esj.struts;

import java.util.HashSet;
import java.util.Set;

import org.apache.struts2.convention.PackageBasedActionConfigBuilder;

import com.opensymphony.xwork2.ObjectFactory;
import com.opensymphony.xwork2.config.Configuration;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.finder.ClassFinder;
import com.opensymphony.xwork2.util.finder.Test;
import com.opensymphony.xwork2.util.logging.Logger;
import com.opensymphony.xwork2.util.logging.LoggerFactory;

public class JarBasedActionConfigBuilder extends PackageBasedActionConfigBuilder{
	
    private static final Logger LOG = LoggerFactory.getLogger(PackageBasedActionConfigBuilder.class);

	private String jarPath;
	private String fileProtocols = "jar";
	
	public JarBasedActionConfigBuilder(Configuration configuration,
			Container container, ObjectFactory objectFactory) {
		super(configuration, container, objectFactory, "true",
				"melon-convention-default");
	}

	@Override
	protected Set<Class> findActions() {
		Set<Class> classes = new HashSet<Class>();
		/*try {
            if (actionPackages != null || (packageLocators != null && !disablePackageLocatorsScanning)) {
                
                // By default, ClassFinder scans EVERY class in the specified
                // url set, which can produce spurious warnings for non-action
                // classes that can't be loaded. We pass a package filter that
                // only considers classes that match the action packages
                // specified by the user
                Test<String> classPackageTest = getClassPackageTest();
                ClassFinder finder = new ClassFinder(getClassLoaderInterface(), buildUrlSet().getUrls(), true, this.fileProtocols, classPackageTest);

                Test<ClassFinder.ClassInfo> test = getActionClassTest();
                classes.addAll(finder.findClasses(test));
            }
        } catch (Exception ex) {
            if (LOG.isErrorEnabled())
                LOG.error("Unable to scan named packages", ex);
        }*/

        return classes;
	}

}
